package com.hyj.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hyj.entity.Fenye;
import com.hyj.entity.Netfollows;
import com.hyj.entity.Students;
import com.hyj.entity.Users;
import com.hyj.service.NetfollowsService;
import com.hyj.service.StudentService;

@Controller
public class NetfollowsController {
	@Autowired
	private Fenye<Netfollows> fenye;
	@Autowired
	private NetfollowsService netfollowsService;
	@Autowired
	private StudentService studentService;
	
	//查询所有跟踪信息
	@RequestMapping(value = "selectNetfollows", method = RequestMethod.POST)
	@ResponseBody
	public Fenye<Netfollows> selectNetfollows(Netfollows netfollows,
			Integer page, Integer rows) {
		fenye.setPage((page - 1) * rows);
		fenye.setPageSize(rows);
		fenye.setNetfollows(netfollows);
		fenye = netfollowsService.selectNetfollows(fenye);
		return fenye;

	}

	/* 添加跟踪 */
	@RequestMapping(value = "getgenzong", method = RequestMethod.POST)
	@ResponseBody
	public Integer getgenzong(Netfollows netfollows) {
		return studentService.addGenzong(netfollows);
	}
	//查询跟踪学生
	@RequestMapping(value = "selectStu", method = RequestMethod.POST)
	@ResponseBody
	public List<Students> selectStu() {
		return netfollowsService.selectStu();
		
	}
	//查询跟踪者信息
	@RequestMapping(value = "selectUsers", method = RequestMethod.POST)
	@ResponseBody
	public List<Users> selectUsers() {
		return netfollowsService.selectUsers();
		
	}
	
	/*查询已回访学生*/
	@RequestMapping(value = "selectYesHiuFang", method = RequestMethod.POST)
	@ResponseBody
	public Fenye<Netfollows> selectYesHiuFang(Fenye<Netfollows> fenye) {
		// TODO Auto-generated method stub
		return netfollowsService.selectYesHiuFang(fenye);
	}
	
	
	

	/*查询已回访学生日志*/
	@RequestMapping(value = "lookHiuFang", method = RequestMethod.POST)
	@ResponseBody
	public Fenye<Netfollows> lookHiuFang(Fenye<Netfollows> fenye,Integer page, Integer rows,Integer sid) {
		// TODO Auto-generated method stub
		fenye.setPage((page - 1) * rows);
		fenye.setPageSize(rows);
		fenye.setSid(sid);
		fenye=netfollowsService.lookHiuFang(fenye);
		return fenye;
	}
	
	
	
}
